//
//  TestViewController.m
//  MVC|MVP|MVVM
//
//  Created by Guo Rui on 2017/11/14.
//  Copyright © 2017年 GR Harry. All rights reserved.
//

#import "TestViewController.h"

@interface TestViewController ()
@property (weak, nonatomic) IBOutlet UILabel *label_1;
@property (weak, nonatomic) IBOutlet UILabel *label_2;

@property (weak, nonatomic) IBOutlet NSLayoutConstraint *label2TopConstraint;
@property (weak, nonatomic) IBOutlet NSLayoutConstraint *label1HeightConstraint;
@property (weak, nonatomic) IBOutlet NSLayoutConstraint *label1TopConstraint;

@property (weak, nonatomic) IBOutlet UIView *redView;
@property (weak, nonatomic) IBOutlet UIView *blackView;
@property (weak, nonatomic) IBOutlet NSLayoutConstraint *blackWidthConstraint;
@property (weak, nonatomic) IBOutlet NSLayoutConstraint *redLeftConstraint;
@property (weak, nonatomic) IBOutlet NSLayoutConstraint *redWidthConstraint;
@property (weak, nonatomic) IBOutlet NSLayoutConstraint *blackLeftConstraint;

@end

@implementation TestViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
}

- (IBAction)button1DidClick:(id)sender {
    self.label1TopConstraint.constant = 0;
    self.label1HeightConstraint.constant = 0;
    
    [UIView animateWithDuration:.2 animations:^{
        [self.view layoutIfNeeded];
    }];
}

- (IBAction)hiddenBlackDidClick:(id)sender {
    self.blackLeftConstraint.constant = 0;
    self.blackWidthConstraint.constant = 0;
    
    [UIView animateWithDuration:.2f animations:^{
        [self.view layoutIfNeeded];
    }];
}

- (IBAction)hiddenRedDidClick:(id)sender {
    self.redLeftConstraint.constant = 0;
    self.redWidthConstraint.constant = 0;
    
    [UIView animateWithDuration:.2f animations:^{
        [self.view layoutIfNeeded];
    }];
}

- (IBAction)button2DidClick:(id)sender {
//    self.label1TopConstraint.constant = 20;
//    self.label1HeightConstraint.constant = 21;
//
//    [UIView animateWithDuration:.2 animations:^{
//        [self.view layoutIfNeeded];
//    }];
    
    self.label_2.text = @"";
    self.label2TopConstraint.constant = 0;
    [UIView animateWithDuration:.2 animations:^{
        [self.view layoutIfNeeded];
    }];
}

@end
